package com.mca.framework.clone;

/**
 * @Author: zhoupeng
 * @createTime: 2025年07月14日 20:43:06
 * @version: 1.0
 * @Description:
 * @copyright:
 */
public class DeepCopy {
    public static void main(String[] args) {
        Person person = new Person("zhangsan",18);

        Student s1 = new Student();
        s1.setPerson(person);
        s1.setName("lisi");
        s1.setAge(19);


        //拷贝
        Student s2 = (Student) s1.clone();
        s2.setName("wangwu");
        s2.setAge(20);

        Person person1 = s2.getPerson();
        person1.setName("zhaoliu");

        System.out.println("s1："+s1.toString());
        System.out.println("s2："+s2.toString());
    }
}
